#pragma once


#include <IXShape.h>
#include "XFrameImpl.h"

enum ShapeFlags
{
    ShapeFlag_None,
    ShapeFlag_ContentTransparent,
    ShapeFlag_Colorize,
};

template <class I>
class CXShapeImpl : public CXFrameImpl<I>
{
    typedef CXFrameImpl<I> superclass;

    BEGIN_DEF_SKIN_CLASS(CXShape, superclass, gs_strGuidXSkin)
        IMP_BASIC_INTF(IXShape,    0)
    END_DEF_SKIN_CLASS();

    IMPL_CONTROL_OBJ(CXShapeImpl, superclass, _T("Shape"));

public:
    CXShapeImpl();
    virtual ~CXShapeImpl();

public:
    // IXShape
    virtual void      STDMETHODCALLTYPE put_ShapeType(IN ShapeType type);

    virtual void      STDMETHODCALLTYPE put_BorderWidth(IN int nBorderWidth);
    virtual void      STDMETHODCALLTYPE put_BorderColor(IN COLORREF clrBorder);
    virtual void      STDMETHODCALLTYPE put_BorderCorner(IN int nBorderCorner);

    virtual void      STDMETHODCALLTYPE put_ContentColor(IN COLORREF clrContent);
    virtual void      STDMETHODCALLTYPE put_ContentTransparent(IN BOOL bTransparent);

public:
    // IXFrame
    virtual void    STDMETHODCALLTYPE   Draw(XCANVAS xCanvas, const RECT& rcDraw);

public:
    // IXBaseObj
    virtual void STDMETHODCALLTYPE   OnFinalRelease();

protected:
    // CXFrameImpl
    virtual void OnColorizeEnabled(BOOL bEnabled);
    virtual void OnColorized(int hue, int sat, int light);

protected:
    void        ChangePen();
    void        ChangeBrush();

protected:
    ShapeType   m_ShapeType;
    int         m_nBorderWidth;
    COLORREF    m_clrBorder;
    int         m_nBorderCorner;
    COLORREF    m_clrContent;

    DWORD       m_dwColorizeValue;

    DWORD       m_dwFlags;

    HPEN        m_hPen;
    HBRUSH      m_hBrush;
};


class CXShape : public CXShapeImpl<IXShape>
{
};
